package com.nwpu.bigdata.service.impl;

import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.eclipse.jetty.util.Loader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

import com.nwpu.bigdata.service.SendMailService;

/**
 *@version:2018年6月17日上午9:57:51
*/
/**
 * @author Administrator
 *
 */
@Service
public class SendMailServiceImpl implements SendMailService{
	private static final Logger logger = LoggerFactory.getLogger(SendMailServiceImpl.class);

	/* (non-Javadoc)
	 * @see com.nwpu.bigdata.service.SendMailService#sendSimpleMail(java.lang.String, java.lang.String, java.lang.String)
	 */
	@Autowired
	JavaMailSender mailSender;
	@Autowired
	SimpleMailMessage simpleMailMessage;
	
	
	
	
	@Override
	public void sendSimpleMail(String subject, String content, String toMail) {
		simpleMailMessage.setSubject(subject);
		simpleMailMessage.setText(content);
		simpleMailMessage.setTo(toMail);
		System.out.println(ReflectionToStringBuilder.toString(simpleMailMessage));
		mailSender.send(simpleMailMessage);
		logger.info("发送成功！");
	}

}
